package com.scetop.bank;

public class Bank {
    private Customer[] customers; // 储存客户
    private int numOfCustomers; // 客户数

    public Bank() {
        customers = new Customer[10]; // 初始化客户数组(假设最大10人)
    }

    // 添加客户(按 firstname、lastname)
    public void addCustomer(String f, String l) {
        Customer customer = new Customer(f, l);
        customers[numOfCustomers] = customer;
        numOfCustomers++;
    }

    // 获取当前客户数  添加getNumOfCustomer 访问方法，它返回numberofCustomers属性值
    public int getNumOfCustomers() {
        return numOfCustomers;
    }

    // 获取指定索引的客户(索引越界返回null)  添加getCustomer方法，它返回与给出index参数相关客户。
    public Customer getCustomer(int index) {
        if (index < 0 || index >= numOfCustomers) {
            return null;
        }
        return customers[index];
    }
}